#include <stdio.h>
#define MaxSize 50
typedef int ElemType;
// 定义顺序表
typedef struct SeqList{
    ElemType data[MaxSize];
    int length;
}SeqList;

// 折半查找、二分查找
int BinarySearch(SeqList &S,ElemType elem){
    // 数组下标从0开始
    int low = 0;
    int height = S.length -1;
    int mid;
    while(low <= height){
        mid = (low + height) / 2;
        if(elem > S.data[mid]){
            low = mid + 1;
        }else if( elem < S.data[mid]){
            height = mid - 1;
        }else{
            return mid;
        }
    }
    return  -1; // 返回-1表示没有找到
}
int main() {
    return 0;
}
